﻿<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <title>無心道-日志系统</title>

    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.min.css" rel="stylesheet">
    <link href="css/style.min.css?v=4.0.0" rel="stylesheet">

    <script charset="utf-8" type="text/javascript" src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script charset="utf-8" type="text/javascript" src="/js/com.wxd.js"></script>

    <link rel="stylesheet" href="style/com.wxd.css">

</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
<div id="wrapper" style="">
    <!--左侧导航开始-->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="nav-close"><i class="fa fa-times-circle"></i>
        </div>
        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <span>
                            <img alt="image" class="img-circle" src="img/profile_small.jpg"/>
                        </span>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                                    <span class="block m-t-xs1"><strong class="font-bold">wxd-gaming</strong></span>
                                    <span class="text-muted text-xs block">超级管理员<b class="caret"></b></span>
                                </span>
                        </a>
                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
                            <!--                            <li><a class="J_menuItem" href="form_avatar.html">修改头像</a></li>-->
                            <!--                            <li><a class="J_menuItem" href="profile.html">个人资料</a></li>-->
                            <!--                            <li><a class="J_menuItem" href="contacts.html">联系我们</a></li>-->
                            <!--                            <li><a class="J_menuItem" href="mailbox.html">信箱</a></li>-->
                            <!--                            <li class="divider"></li>-->
                            <li><a href="/login.html" onclick="wxd.clearCookie();">安全退出</a></li>
                        </ul>
                    </div>
                    <div class="logo-element">H+
                    </div>
                </li>
                <li>
                    <a href="#">
                        <i class="fa fa-home"></i>
                        <span class="nav-label">实时大屏</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li id="side-menu-sub-game-real-all">
                            <a id="side-menu-sub-game-real-all-a" class="J_menuItem" href="game-real-all.html">实时大屏</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row content-tabs">
            <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
            </button>
            <nav class="page-tabs J_menuTabs">
                <div class="page-tabs-content">
                </div>
            </nav>
        </div>
        <div class="row J_mainContent" id="content-main">
            <iframe class="J_iframe" name="iframe0" width="100%" height="100%" style="box-sizing: border-box;border: 0;margin:  0;padding: 0;" src=""></iframe>
        </div>
    </div>
    <!--右侧部分结束-->
</div>

<script type="application/javascript">

    let defaultRouting = [
        ["/log/error.html", "错误日志"],
        ["/server-list.html", "区服信息"],
        ["/server-list-test.html", "测试区服信息"],
        ["/game-real.html", "实时大屏"],
        ["/stat/game.html", "游戏统计"],
        ["/log/role/recharge.html", "充值详情"],
        ["/game-recharge-group.html", "充值分布图"],
        ["/stat/online.html", "在线统计"],
        ["/stat/online-server.html", "区服在线统计"],
        ["/stat/account.html", "账号留存"],
        ["/log/account.html", "账号列表"],
        ["/log/role/role.html", "角色列表"],
        ["/log/role/login.html", "登录记录"],
        ["/log/role/role-online.html", "在线时长查询"],
        ["/log/role/item.html", "道具日志"],
        ["/game-item-group.html", "道具分布图"],
    ]

    function getMenu() {
        wxd.loading();
        let postQuery = new wxd.Map().loadSearch();
        postQuery.put("pageIndex", 1);
        postQuery.put("pageSize", 10000);
        let url = "/game/menu";
        wxd.netty.post(url, postQuery.toString(),
            function (responseText) {
                if (responseText.code !== 1) {
                    wxd.message.alert(responseText.msg, "Error", "确认", () => {
                        window.top.location.href = "/login.html";
                    });
                    return;
                }

                let isAdmin = responseText.admin;
                if (isAdmin) {
                    let adminLi = `
                <li>
                    <a href="#">
                        <i class="fa fa-home"></i>
                        <span class="nav-label">管理</span>
                        <span class="fa arrow"></span>
                    </a>
                    <ul class="nav nav-second-level">
                        <li id="side-menu-sub-admin">
                            <a class="J_menuItem" href="game-list.html">游戏列表</a>
                            <a class="J_menuItem" href="user.html" title="登录账号管理">用户列表</a>
                        </li>
                    </ul>
                </li>
`;
                    $("#side-menu").append(adminLi);
                }

                var data = responseText.data;
                for (const datum of data) {

                    let appendA = "";
                    let routings = responseText.routings;

                    for (const routing of defaultRouting) {
                        for (const key in routings) {
                            if (routings[key] === routing[0]) {
                                appendA += `<a class="J_menuItem" href="${routing[0]}?gameId=${datum.uid}">${datum.name}-${routing[1]}</a>`;
                                break;
                            }
                        }
                    }

                    let serverTableMapping = datum.serverTableMapping;
                    for (const key in serverTableMapping) {
                        appendA += `<a class="J_menuItem" href="/log/server/s-server-log.html?gameId=${datum.uid}&logType=${key}">${datum.name}-${serverTableMapping[key]}</a>`;
                    }

                    let roleTableMapping = datum.roleTableMapping;
                    for (const key in roleTableMapping) {
                        appendA += `<a class="J_menuItem" href="/log/role/s-role-log.html?gameId=${datum.uid}&logType=${key}">${datum.name}-${roleTableMapping[key]}</a>`;
                    }

                    let appendLi = `
                        <li>
                            <a href="#">
                                <i class="fa fa-home"></i>
                                <span class="nav-label">${datum.name}</span>
                                <span class="fa arrow"></span>
                            </a>
                            <ul class="nav nav-second-level">
                                <li id="game-menu-sub-${datum.uid}">
                                    ${appendA}
                                </li>
                            </ul>
                        </li>
                        `;
                    $("#side-menu").append(appendLi);
                }
            },
            () => {
                wxd.message.alert(responseText.msg, "Error", "确认", () => {
                    window.top.location.href = "/login.html";
                });
            },
            false,
            30_000
        );
    }

    getMenu();

</script>

<script type="text/javascript" src="js/bootstrap.min.js?v=3.3.5"></script>
<script type="text/javascript" src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script type="text/javascript" src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="js/plugins/layer/layer.min.js"></script>
<script type="text/javascript" src="js/hplus.min.js?v=4.0.0"></script>
<script type="text/javascript" src="js/contabs.min.js"></script>
<script type="text/javascript" src="js/plugins/pace/pace.min.js"></script>
</body>
<script>
    setTimeout(() => {
        $("#side-menu-sub-game-real-all-a").click();
    }, 200);
</script>
</html>